#include <iostream>
#include <algorithm>
using namespace std;
bool is_prime(int n)
{
    if (n < 2)
        return false;
    for (int i = 2; i <= n / i; i++)  //相当于i<=sqrt(n)
    {
        if (n % i == 0)
            return false;
    }
    return true;
}
int main()
{
    int n;
    cin >> n;

    while (n--) 
    {
        int x;
        cin >> x;

        if (is_prime(x)) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}